package top.drinyeit.nongmao.activity;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.HashMap;
import java.util.Map;

import top.drinyeit.nongmao.R;
import top.drinyeit.nongmao.base.BaseActivity;
import top.drinyeit.nongmao.presenter.StoreInfoPresenter;

/**
 * Created by wu on 2018/1/10.
 */

public class StoreInfoActivity extends BaseActivity {
    private ImageView back;
    public ImageView head_photo, sanitary_certificate, business_license;
    public TextView store_name, store_number, score, store_open_time, description_score, service_score, logistics_score;
    private int storeId;
    private StoreInfoPresenter storeInfoPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_store_info);

        initIntent();
        initView();
        initData();
        setTitle(true, "店铺信息");
    }

    private void initIntent() {
        Bundle bundle = getIntent().getExtras();
        if (bundle != null) {
            storeId = bundle.getInt("store_id");
        } else {
            storeId = 1;
        }
    }

    private void initView() {
        back = findViewById(R.id.back);
        head_photo = findViewById(R.id.head_photo);
        store_name = findViewById(R.id.store_name);
        sanitary_certificate = findViewById(R.id.sanitary_certificate);
        business_license = findViewById(R.id.business_license);
        store_number = findViewById(R.id.store_number);
        score = findViewById(R.id.score);
        store_open_time = findViewById(R.id.store_open_time);
        description_score = findViewById(R.id.description_score);
        service_score = findViewById(R.id.service_score);
        logistics_score = findViewById(R.id.logistics_score);
    }

    private void initData() {
        storeInfoPresenter = new StoreInfoPresenter(this);
        Map<String, Object> map = new HashMap<>();
        map.put("action", "commodity_store_info");
        map.put("store_id", storeId);
        storeInfoPresenter.getStoreInfo(map);
    }

}
